Skip to content

Simpler null constant checks.#37472

Merged
cincuranet merged 1 commit intodotnet:mainfrom
cincuranet:isnullconstant
Feb 2, 2026
Merged

Simpler null constant checks.#37472
cincuranet merged 1 commit intodotnet:mainfrom
cincuranet:isnullconstant

Conversation

@cincuranet
Copy link
Contributor

No description provided.

@roji roji force-pushed the main branch 2 times, most recently from 249ae47 to 6b86657 Compare January 13, 2026 17:46
@cincuranet cincuranet marked this pull request as ready for review February 2, 2026 10:15
@cincuranet cincuranet requested a review from a team as a code owner February 2, 2026 10:15
Copilot AI review requested due to automatic review settings February 2, 2026 10:15
@cincuranet cincuranet enabled auto-merge (squash) February 2, 2026 10:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies internal null-constant checks in query expression visitors by inlining pattern matching instead of using small private helper methods. The behavior is preserved while slightly reducing indirection.

Changes:

  • In QueryOptimizingExpressionVisitor, inline the IsNullConstant helper logic directly into the conditional optimization and remove the unused private helper.
  • In InMemoryExpressionTranslatingExpressionVisitor, inline the IsNullConstantExpression helper logic into the entity-equality rewrite path and delete the now-unneeded private helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/EFCore/Query/Internal/QueryOptimizingExpressionVisitor.cs Replaces calls to a private IsNullConstant helper with inline ConstantExpression { Value: null } pattern checks and removes the helper, preserving the conditional rewrite semantics.
src/EFCore.InMemory/Query/Internal/InMemoryExpressionTranslatingExpressionVisitor.cs Inlines null-constant detection for entity-equality rewrites using pattern matching and removes the redundant private helper, leaving existing extension-based null checks elsewhere unchanged.

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@cincuranet cincuranet merged commit 2699a85 into dotnet:main Feb 2, 2026
15 of 16 checks passed
@cincuranet cincuranet deleted the isnullconstant branch February 2, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants